package com.foreknow.demo02;

import java.util.Scanner;

/**
 * 嵌套的if
 *
 */
public class ControllerDemo4 {
    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        System.out.println("请输入是否是会员:是(y)/否(n)");
        //接收控制台的输入的字符串
        String identity = input.next();
        System.out.println("请输入购物的金额");
        double money = input.nextDouble();
        //字符串之间来进行比较等价性要使用equals方法
        if(identity.equals("y")){ //首先要判断是否是会员
            if(money > 200) {
                money = money*0.75;
            }else {
                money = money*0.8;
            }
        }else { //非会员的情况
            if(money > 100){
                money = money*0.9;
            }
        }
        System.out.println("实际支付:"+money);
    }
}